<?php

App::uses('AppModel', 'Model');

class Page extends AppModel {

    public $belongsTo = array( 'Category' );

    public function beforeSave($options = array()) {
        $return = parent::beforeSave($options);
        if ($return) {
            $title = $this->data['Page']['title'];
            $this->data['Page']['key'] = urlize($title);
        }
        
        return $return;
    }

}